package com.yeyks.order.vo;

import cn.hutool.json.JSONUtil;
import com.yeyks.common.constants.OrderHeadExtraInfoConstant;
import com.yeyks.order.dal.domain.OrderHead;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class OrderHeadOrderListVo extends OrderHead {

    public List<String> getHotelImages() {
        try {
            return JSONUtil.parseObj(getExtraInfo()).getJSONArray(OrderHeadExtraInfoConstant.HOTEL_IMG_URLS).toList(String.class);
        } catch (Exception e) {
        }
        return new ArrayList<>();
    }

    public List<String> getRoomImages() {
        try {
            return JSONUtil.parseObj(getExtraInfo()).getJSONArray(OrderHeadExtraInfoConstant.ROOM_IMG_URLS).toList(String.class);
        } catch (Exception e) {
        }
        return new ArrayList<>();
    }

    public String getHotelPhone() {
        try {
            return JSONUtil.parseObj(getExtraInfo()).getStr(OrderHeadExtraInfoConstant.HOTEL_PHONE);
        } catch (Exception e) {
        }
        return "";
    }

    public String getHotelTel() {
        try {
            return JSONUtil.parseObj(getExtraInfo()).getStr(OrderHeadExtraInfoConstant.HOTEL_TEL);
        } catch (Exception e) {
        }
        return "";
    }

}
